import React from 'react';
import {
  SemiIcons,
  IconKeys,
  type SemiIconProps,
} from '@/components/icons/types';
import './index.less';

const SemiIcon = (props: Partial<SemiIconProps>) => {
  const { name, ...attrs } = props;

  return (
    <>
      {name &&
      name !== 'default' &&
      name !== 'convertIcon' &&
      IconKeys.includes(name)
        ? React.createElement(SemiIcons[name], attrs)
        : null}
    </>
  );
};

export default SemiIcon;
